package com.group9.repository;

import com.group9.pojo.CommentMessage;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Lcouncillor on 2020/6/9.
 */

public interface CommentMessageRepository {
    /**
     * 通过接收者id查询所有未读消息
     * @param receiverId
     * @return
     */
    List<CommentMessage> selectNoReadMessageByReceiverId(String receiverId);
    /**
     * 通过接收者id查询所有未读消息
     * @param receiverId
     * @return
     */
    List<CommentMessage> selectReadedMessageByReceiverId(String receiverId);

    Integer insertCommentMessage(CommentMessage commentMessage);

    CommentMessage selectCommentMessageById(String messageId);

    /**
     * 通过一级评论id和接收者id
     * @param commentId
     * @param receiverId
     * @return
     */
    List<CommentMessage> selectByCommentIdAndUserId(String commentId,String receiverId);

    /**
     * 将所有消息改变为已读状态
     * @param commentMessages
     * @return
     */
    Integer updateStatus(List<CommentMessage> commentMessages);
}
